.container {
  overflow: hidden;
  background-color: var(--color-gray-900);
  border: 1px solid var(--color-gray-800);
  border-radius: var(--border-radius-md);
  transition: border-color 0.15s ease;
}

.container:hover {
  border-color: var(--color-gray-700);
}

.container[data-status='running'] {
  border-color: var(--color-gray-100);
  box-shadow: 0 0 0 1px var(--color-gray-alpha-20, rgba(255, 255, 255, 0.1));
}

.container[data-status='error'] {
  background-color: var(--color-vermilion-alpha-10, rgba(213, 82, 53, 0.1));
  border-color: var(--color-vermilion-900, #d55235);
}

.header {
  width: 100%;
  padding: var(--spacing-3);
  text-align: left;
  cursor: pointer;
  background: transparent;
  border: none;
  transition: color 0.15s ease;
}

.header:focus {
  outline: none;
}

.header:focus-visible {
  outline: 2px solid var(--color-blue-500, #3b82f6);
  outline-offset: 2px;
  border-radius: var(--border-radius-base);
}

.header:hover .toolName,
.header:hover .statusText,
.header:hover .chevron,
.header:hover .icon {
  color: var(--color-gray-50);
}

.headerContent {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.headerLeft {
  display: flex;
  gap: var(--spacing-1-5, 6px);
  align-items: center;
}

.iconWrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.icon {
  position: absolute;
  width: 16px;
  height: 16px;
  color: var(--color-gray-100);
  opacity: 0;
  transition:
    opacity 0.25s ease,
    transform 0.25s ease;
}

.header[data-expanded='true'] .chevron {
  opacity: 1;
  transform: rotate(0deg);
}

.header[data-expanded='false']:hover .chevron {
  opacity: 1;
  transform: rotate(-90deg);
}

.header[data-expanded='false'] .wrench {
  opacity: 1;
}

.header[data-expanded='false']:hover .wrench {
  opacity: 0;
}

.titleWrapper {
  display: flex;
  gap: var(--spacing-2);
  align-items: center;
}

.toolName {
  font-size: var(--font-size-4);
  font-weight: 500;
  color: var(--color-gray-100);
  transition: color 0.15s ease;
}

/* Apply pulse animation to tool name when running */
.container[data-status='running'] .toolName {
  animation: glow 2s ease-in-out infinite;
}

.statusText {
  font-size: var(--font-size-3);
  color: var(--color-gray-300);
  transition: color 0.15s ease;
}

@keyframes glow {
  0%,
  100% {
    color: var(--color-gray-100);
  }
  50% {
    color: var(--color-white, #ffffff);
  }
}

.headerRight {
  display: flex;
  gap: var(--spacing-2);
  align-items: center;
}

.badgeError {
  padding: 2px 8px;
  font-size: var(--font-size-2);
  font-weight: 500;
  color: var(--color-vermilion-900, #d55235);
  background-color: var(--color-vermilion-alpha-20, rgba(213, 82, 53, 0.2));
  border-radius: var(--border-radius-sm);
}

.contentWrapper {
  position: relative;
}

.content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-4);
  overflow: hidden;
  transition:
    max-height 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.4s ease-out,
    padding 0.5s cubic-bezier(0.4, 0, 0.2, 1),
    margin 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.container[data-expanded='true'] .content {
  position: relative;
  max-height: none; /* Remove height limit when expanded */
  padding: 0 var(--spacing-3) var(--spacing-3);
  margin: 0;
  overflow-x: hidden;
  overflow-y: visible;
  opacity: 1;
  /* Ensure smooth scrolling stays at bottom during animation */
  overflow-anchor: none;
  scroll-behavior: smooth;
}

.container[data-expanded='false'] .content {
  max-height: 0;
  padding: 0 var(--spacing-3) 0;
  margin: 0;
  pointer-events: none;
  opacity: 0;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .container {
    transition: none;
  }

  .header {
    transition: none;
  }

  .chevron {
    transition: none;
  }

  .icon {
    transition: none;
  }

  .toolName {
    transition: none;
  }

  .container[data-status='running'] .toolName {
    animation: none;
  }

  .statusText {
    transition: none;
  }

  .content {
    transition: none;
  }
}
